home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
AMUG
/
PROGRAMMING
/
Raven 1.2 Examples.sit
/
Raven 1.2 Examples
/
Quill
/
Source
/
ScrollerEditor.cpp
< prev
next >
Wrap
Text File
|
1997-05-03
|
5KB
|
179 lines
/*
* File: ScrollerEditor.cpp
* Summary: A view that knows how to edit a TScroller.
* Written by: Jesse Jones
*
* Copyright ゥ 1996 Jesse Jones.
* For conditions of distribution and use, see copyright notice in ZTypes.h
*
* Change History (most recent first):
*
* <-> 12/07/96 JDJ Created
*/
#include "ScrollerEditor.h"
#include <ZColorSwatch.h>
#include <ZControl.h>
#include <ZTextBox.h>
// ===================================================================================
// class CEditScrollerCommand
// ===================================================================================
//---------------------------------------------------------------
//
// CEditScrollerCommand::~CEditScrollerCommand
//
//---------------------------------------------------------------
CEditScrollerCommand::~CEditScrollerCommand()
{
}
//---------------------------------------------------------------
//
// CEditScrollerCommand::CEditScrollerCommand
//
//---------------------------------------------------------------
CEditScrollerCommand::CEditScrollerCommand(TScroller* pane, const SScrollerInfo& oldInfo, const SScrollerInfo& newInfo) : Inherited(pane, oldInfo, newInfo)
{
}
//---------------------------------------------------------------
//
// CEditScrollerCommand::UpdatePane
//
//---------------------------------------------------------------
void CEditScrollerCommand::UpdatePane(const SScrollerInfo& info)
{
mPane->SetInfo(info);
}
#pragma mark -
// ===================================================================================
// CScrollerEditor
// ===================================================================================
static TReanimatorRegister<CScrollerEditor> sScrollerEditorRegistrar;
//---------------------------------------------------------------
//
// CScrollerEditor::~CScrollerEditor
//
//---------------------------------------------------------------
CScrollerEditor::~CScrollerEditor()
{
}
//---------------------------------------------------------------
//
// CScrollerEditor::CScrollerEditor
//
//---------------------------------------------------------------
CScrollerEditor::CScrollerEditor(TView* superView) : Inherited(superView)
{
}
//---------------------------------------------------------------
//
// CScrollerEditor::Create [static]
//
//---------------------------------------------------------------
MReanimatable* CScrollerEditor::Create(MReanimatable* parent)
{
return new CScrollerEditor(dynamic_cast<TView*>(parent));
}
//---------------------------------------------------------------
//
// CScrollerEditor::GetEditorInfo
//
//---------------------------------------------------------------
SScrollerInfo CScrollerEditor::GetEditorInfo() const
{
SScrollerInfo info;
TTextBox* textBox = nil;
TControl* control = nil;
TColorSwatch* color = nil;
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("SubPane Name"));
info.subPaneName = textBox->GetText();
control = dynamic_cast<TControl*>(this->FindSubPane("Has Horz"));
info.hasHorzScrollBar = control->GetValue();
control = dynamic_cast<TControl*>(this->FindSubPane("Has Vert"));
info.hasVertScrollBar = control->GetValue();
color = dynamic_cast<TColorSwatch*>(this->FindSubPane("Back Color"));
info.backColor = color->GetColor();
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Left Indent"));
info.indent.left = textBox->GetValue();
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Right Indent"));
info.indent.right = textBox->GetValue();
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Top Indent"));
info.indent.top = textBox->GetValue();
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Bottom Indent"));
info.indent.bottom = textBox->GetValue();
control = dynamic_cast<TControl*>(this->FindSubPane("Erase on Update"));
info.eraseOnUpdate = control->GetValue();
return info;
}
//---------------------------------------------------------------
//
// CScrollerEditor::SetEditorInfo
//
//---------------------------------------------------------------
void CScrollerEditor::SetEditorInfo(const SScrollerInfo& info)
{
TTextBox* textBox = nil;
TControl* control = nil;
TColorSwatch* color = nil;
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("SubPane Name"));
textBox->SetText(info.subPaneName);
control = dynamic_cast<TControl*>(this->FindSubPane("Has Horz"));
control->SetValue(info.hasHorzScrollBar);
control = dynamic_cast<TControl*>(this->FindSubPane("Has Vert"));
control->SetValue(info.hasVertScrollBar);
color = dynamic_cast<TColorSwatch*>(this->FindSubPane("Back Color"));
color->SetColor(info.backColor);
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Left Indent"));
textBox->SetValue(info.indent.left);
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Right Indent"));
textBox->SetValue(info.indent.right);
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Top Indent"));
textBox->SetValue(info.indent.top);
textBox = dynamic_cast<TTextBox*>(this->FindSubPane("Bottom Indent"));
textBox->SetValue(info.indent.bottom);
control = dynamic_cast<TControl*>(this->FindSubPane("Erase on Update"));
control->SetValue(info.eraseOnUpdate);
}